package com.devshephard.rpcframework.rpc.register;

import com.devshephard.rpcframework.rpc.util.TcpResourceHolder;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class ResourceContextProcess implements BeanPostProcessor, ApplicationContextAware {
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        // 通过上下文，根据接口类型返回相应的所有实现类bean
        TcpResourceHolder.setApplicationContext(applicationContext);
    }
}
